#{extends '/template/main.html' /}

<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title" style="height:30px;line-height: 50px;">订单详情</h3>
        #{if report.trial == null}
            <div class="panel-options" style="padding: 0px 0px;">
                <button class="btn btn-red" id="distribute_btn" style="float: right;margin: 0px 22px;" onclick="saveTrial('USER')">用户投诉成功</button>
            </div>
            <div class="panel-options" style="padding: 0px 0px;">
                <button class="btn btn-blue" id="distribute_btn" style="float: right;margin: 0px 0px;" onclick="saveTrial('MERCHANT')" >商户投诉成功</button>
            </div>
        #{/if}


    </div>
    <div id="haspay" style="position: absolute;top:100px;left:160px;z-index: 999999;opacity: 0.8;display:none;">
        <img src="/public/images/haspay.png" width="160px"/>
    </div>

    <div class="panel-body row">
            <div class="col-xs-6">
                <label class="col-sm-1 control-label" for="field-1" style="width: 120px;padding-top: 8px;">订单编号:</label>
                <div class="col-sm-8" style="padding-left: 0px;">
                    <input type="text" class="form-control" readonly value="${report?.order?.orderNumber}" style="background: #ffffff;border:none;color:red;">
                </div>
            </div>
            <div class="col-xs-6">
                <label class="col-sm-1 control-label" for="field-2" style="width: 120px;padding-top: 8px;">收货人姓名:</label>
                <div class="col-sm-8" style="padding-left: 0px;">
                    <input type="text" class="form-control" readonly value="${report?.order?.address.userName}" style="background: #ffffff;border:none;">
                </div>
            </div>
            <div class="col-xs-6">
                <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">下单人:</label>

                <div class="col-sm-8" style="padding-left: 0px;">
                    <input type="text" class="form-control" readonly value="${report?.order?.webUser?.nickName}" style="background: #ffffff;border:none;">
                </div>
            </div>
            <div class="col-xs-6">
                <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">下单时间:</label>

                <div class="col-sm-8" style="padding-left: 0px;">
                    <input type="text" class="form-control" readonly value="${report?.order?.createdAt}" style="background: #ffffff;border:none;">
                </div>
            </div>
            <div class="col-xs-6">
                <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">订单类型:</label>

                <div class="col-sm-8" style="padding-left: 0px;">
                    <input type="text" class="form-control" readonly value="&{'GoodsType.' + report?.order?.goodsType}" style="background: #ffffff;border:none;">
                </div>
            </div>
            <div class="col-xs-6">
                <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">订单来源:</label>

                <div class="col-sm-8" style="padding-left: 0px;">
                    <input type="text" class="form-control" readonly value="&{'OrderType.' + report?.order?.type}" style="background: #ffffff;border:none;">
                </div>
            </div>
            <div class="col-xs-6">
                <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">订单金额:</label>

                <div class="col-xs-8" style="padding-left: 0px;">
                    <input type="text" class="form-control" readonly value="${report?.amount?.format('#.##')} 元" style="background: #ffffff;border:none;">
                </div>
            </div>
            <div class="col-xs-6">
                <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">订单备注:</label>

                <div class="col-xs-8" style="padding-left: 0px;">
                    <input type="text" class="form-control" readonly value="${report?.order?.remark == null ? '暂无' : report?.order?.remark}" style="background: #ffffff;border:none;">
                </div>
            </div>
            <div class="col-xs-6">
                <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">订单状态:</label>

                <div class="col-xs-8" style="padding-left: 0px;">
                    <input type="text" class="form-control" readonly value="&{'OrderStatus.' + report?.order?.status}" style="background: #ffffff;border:none;">
                </div>
            </div>
            <div class="col-xs-6">
                <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">确认支付状态:</label>
                <div class="col-xs-8" style="padding-left: 0px;">
                    <input type="text" class="form-control" readonly value="${report?.order?.confirmStatus == null ? '未确认':'已确认'}" style="background: #ffffff;border:none;">
                </div>
            </div>
           <div class="col-xs-6">
                <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">收货人姓名:</label>
                <div class="col-xs-8" style="padding-left: 0px;">
                    <input type="text" class="form-control" readonly value="${report?.order?.address.userName}" style="background: #ffffff;border:none;">
                </div>
            </div>
            <div class="col-xs-6">
                <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">收货人电话:</label>
                <div class="col-xs-8" style="padding-left: 0px;">
                    <input type="text" class="form-control" readonly value="${report?.order?.address.phone}" style="background: #ffffff;border:none;">
                </div>
            </div>
            <div class="col-xs-6">
                <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">地址:</label>
                <div class="col-xs-8" style="padding-left: 0px;">
                    <input type="text" class="form-control" readonly value="${report?.order?.address.address}${report?.order?.address.confirmAddress}" style="background: #ffffff;border:none;">
                </div>
            </div>
    #{if report.trial != null}
        <div class="col-xs-12">
            <label class="col-sm-2 control-label" for="field-2" style="width: 130px;padding-top: 8px;">审核状态:</label>
            <div class="col-xs-8" style="padding:10px 0 20px 0; background: #ffffff;border:none;color:red;">
                #{if report.trial.toString() == 'USER'}
                    用户投诉成功
                #{/if}
                #{if report.trial.toString() == 'MERCHANT'}
                    商户投诉成功
                #{/if}
            </div>
        </div>
    #{/if}
    #{if report.refund != null}
        <div class="col-xs-12">
            <label class="col-sm-2 control-label" for="field-2" style="width: 130px;padding-top: 8px;">退款类型:</label>
            <div class="col-xs-8" style="padding:10px 0 20px 0; background: #ffffff;border:none;color:red;">
                #{if report.refund.toString() == 'SELLER_AGREES'}
                    卖家同意退款
                #{/if}
                #{if report.refund.toString() == 'ADMIN_AGREES'}
                    管理员审核退款
                #{/if}
            </div>
        </div>
    #{/if}
        #{list reportRemarks , as :'reportRemark'}
            #{if reportRemark.reportUserType.toString() == 'USER'}
                <div class="col-xs-12">
                    <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">用户投诉图片:</label>
                    <div class="col-xs-8" style="padding:10px 0 20px 0;">
                        <img src="${reportRemark?.reportImage}">
                    </div>
                </div>
                    <div class="col-xs-12">
                        <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">用户投诉备注:</label>
                        <div class="col-xs-8" style="padding-left: 0px;">
                            <textarea style="width: 100%; height: 80px; padding-top: 8px;" id="reportRemarks1" class="areabox" readonly  name="reportRemarks1">${reportRemark?.reportRemarks} </textarea>
                        </div>
                    </div>
              #{/if}
            #{if reportRemark.reportUserType.toString() == 'MERCHANT'}
                    <div class="col-xs-12">
                        <label class="col-sm-2 control-label" for="field-2" style="width: 120px;padding-top: 8px;">客户申诉备注:</label>
                        <div class="col-xs-8" style="padding-left: 0px;">
                            <textarea style="width:100%; height: 80px; padding-top: 8px;" id="reportRemarks2" class="areabox" readonly  name="reportRemarks2">${reportRemark?.reportRemarks} </textarea>
                        </div>
                    </div>
            #{/if}

        #{/list}
        <div>
            <table class="table table-bordered table-striped" id="example-2">
                <thead>
                <tr>
                    <th>商品名称</th>
                    <th>规格</th>
                    <th>单价</th>
                    <th>购买数量</th>
                    <th>价格</th>
                </tr>
                </thead>

                <tbody class="middle-align">

                <tr>
                    <td>${report?.orderItem?.goods?.name}</td>
                    <td>${report?.orderItem?.goods?.spec}</td>
                    <td>${report?.salePrice}</td>
                    <td>${report?.buyNumber}</td>
                    <td>${report?.amount}</td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>

<!-- Imported styles on this page -->
<link rel="stylesheet" href="/public/js/wysihtml5/src/bootstrap-wysihtml5.css">
<link rel="stylesheet" href="/public/js/uikit/vendor/codemirror/codemirror.css">
<link rel="stylesheet" href="/public/js/uikit/uikit.css">
<link rel="stylesheet" href="/public/js/uikit/css/addons/uikit.almost-flat.addons.min.css">
<script src="/public/js/wysihtml5/lib/js/wysihtml5-0.3.0.js"></script>
<!-- Imported scripts on this page -->
<script src="/public/js/wysihtml5/src/bootstrap-wysihtml5.js"></script>
<script src="/public/js/uikit/vendor/codemirror/codemirror.js"></script>
<script src="/public/js/uikit/vendor/marked.js"></script>
<script src="/public/js/uikit/js/uikit.min.js"></script>
<script src="/public/js/uikit/js/addons/htmleditor.min.js"></script>
<script src="/public/js/ckeditor/ckeditor.js"></script>
<script src="/public/js/ckeditor/adapters/jquery.js"></script>

<!-- Imported scripts on this page -->
<script src="/public/js/jquery-validate/jquery.validate.min.js"></script>
<script type="text/javascript" src="/public/lib/layer/js/layer.js"></script>

<script>
    function saveTrial(userType){
        var userType = userType;
        var reportId = '${report?.id}';
        var msg = "您确认是用户投诉成功?";
        if(userType == 'MERCHANT')
            msg='您确认商户投诉成功?';
        layer.confirm(msg, {
            btn: ['确认','取消'] //按钮
        }, function(){
            $.getJSON("/BS00029/admin/complaint/trial/trialConfirm",{userType: userType,reportId: reportId},
                    function (data) {
                        if(data.success){
                            layer.alert(data.msg);
                            setTimeout("location.reload()", 2000);
                            document.location.href='/BS00029/admin/complaint/trial/index/1';
                        }else{
                            layer.alert(data.msg);
                        }
                    }
            );
        }, function(){
            layer.closeAll();
        });


    }

</script>